package com.zmn.oms.common.enums;

/**
 * 渠道收款限制
 *
 * @author xiangjunming
 * @since 2020/03/26 14:56:30
 */
public enum ConfChannelReceivablesLimitEnum {

	/**
	 * values
	 */
	XDYF(ConfChannelReceivablesLimitEnum.CONSTS_XDYF, "下单预付全款"),
	GCS(ConfChannelReceivablesLimitEnum.CONSTS_GCS, "工程师收全款"),
	YFWK(ConfChannelReceivablesLimitEnum.CONSTS_YFWK, "预付+尾款"),
	HF(ConfChannelReceivablesLimitEnum.CONSTS_HF, "后付费"),
	;

	/**
	 * 下单预付全款
	 */
	public final static int CONSTS_XDYF = 1;
	/**
	 * 工程师收全款
	 */
	public final static int CONSTS_GCS = 2;
	/**
	 * 预付+尾款
	 */
	public final static int CONSTS_YFWK = 3;
	/**
	 * 后付费
	 */
	public final static int CONSTS_HF = 4;

	private Integer code;
	private String name;

	ConfChannelReceivablesLimitEnum(Integer code, String name) {
		this.code = code;
		this.name = name;
	}

	public Integer getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public static ConfChannelReceivablesLimitEnum of(Integer code) {
		if (code == null) {
			return null;
		}
		switch (code) {
			case 1:
				return XDYF;
			case 2:
				return GCS;
			case 3:
				return YFWK;
			case 4:
				return HF;
			default:
				return null;
		}
	}

	public static String getName(Integer code) {
		ConfChannelReceivablesLimitEnum of = of(code);
		return of == null ? null : of.getName();
	}

}
